from typing import Annotated

from fastapi import  APIRouter, Depends
from sqlalchemy.orm import Session

import models
from auth import get_current_active_user
from db import get_db
from models import dictionary


router = APIRouter(prefix="/api/dictionary", tags=["词典"])

@router.get("/all")
def get_dictionary_all(current_user: Annotated[models.User, Depends(get_current_active_user)], db: Session = Depends(get_db)):
    return db.query(dictionary).all()

@router.get("/{id}")
def get_dictionary(current_user: Annotated[models.User, Depends(get_current_active_user)],id: int, db: Session = Depends(get_db)):
    return db.query(dictionary).get(id)
